package com.nogroup.springbootproject.service.impl;

import com.nogroup.springbootproject.dao.DataCountDao;
import com.nogroup.springbootproject.service.DataCountService;
import com.nogroup.springbootproject.vo.DataCountVo;
import com.nogroup.springbootproject.vo.EchartsPieVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

@Service("dataCountService")
@Transactional(rollbackFor = Exception.class)
public class DataCountServiceImpl implements DataCountService {
    @Resource
    private DataCountDao dataCountDao;

    @Override
    public DataCountVo getMainData() {
        DataCountVo dataCountVo = new DataCountVo();
        dataCountVo.setApplyTotal(dataCountDao.applyCount());
        dataCountVo.setAuditTotal(dataCountDao.auditCount());
        dataCountVo.setPassTotal(dataCountDao.passCount());
        dataCountVo.setStudentTotal(dataCountDao.studentCount());
        dataCountVo.setFailTotal(dataCountDao.failCount());
        return dataCountVo;
    }

    @Override
    public List<EchartsPieVo> getClassApplyCountForPie() {
        return dataCountDao.getClassApplyCountForPie();
    }
}
